#include "FiveWin.ch"

#define WM_MDICREATE        544   // 0x0220
#define WM_MDIDESTROY       545   // 0x0221
#define WM_MDIACTIVATE      546   // 0x0222
#define WM_MDIRESTORE       547   // 0x0223
#define WM_MDINEXT          548   // 0x0224
#define WM_MDIMAXIMIZE      549   // 0x0225
#define WM_MDITILE          550   // 0x0226
#define WM_MDICASCADE       551   // 0x0227
#define WM_MDIICONARRANGE   552   // 0x0228
#define WM_MDIGETACTIVE     553   // 0x0229
#define WM_MDISETMENU       554   // 0x0230

static lRegistered := .f.

//----------------------------------------------------------------------------//

CLASS TMdiChild FROM TWindow

   DATA   oWndClient

   METHOD New( nTop, nLeft, nBottom, nRight, cTitle, nStyle, oMenu,;
               oWndClient ) CONSTRUCTOR
   METHOD Maximize() BLOCK { | Self | ::oWndClient:Maximize( Self ) }
   METHOD Restore()  BLOCK { | Self | ::oWndClient:Restore( Self ) }
   METHOD Activate() BLOCK { | Self | ::oWndClient:Activate( Self ) }

ENDCLASS

//----------------------------------------------------------------------------//

METHOD New( nTop, nLeft, nBottom, nRight, cTitle, nStyle, oMenu, oWndClient ) ;
       CLASS TMdiChild

   DEFAULT cTitle := "MDI Child"

   ::oWndClient = oWndClient

   if ! lRegistered
      RegisterClass( ::ClassName(),;
                     nOR( CS_VREDRAW, CS_HREDRAW ),;
                     0, 0, 0, 0, 0, "", GetMDIChlProc() )
      lRegistered = .t.
   endif

   ::hWnd = ::oWndClient:SendMsg( WM_MDICREATE, 0,;
        cMdiStruct( ::ClassName(), cTitle, nTop, nLeft, nBottom, nRight ) )
   ::Link()

   if oMenu != nil
      ::oMenu = oMenu
   endif

return

//----------------------------------------------------------------------------//
